﻿using CoreLib.Plugins;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using CoreLib;
namespace CoreLibTestUnit
{
    
    
    /// <summary>
    ///This is a test class for PluginManagerTest and is intended
    ///to contain all PluginManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class PluginManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for PluginManager Constructor
        ///</summary>
        [TestMethod()]
        public void PluginManagerConstructorTest()
        {
            PluginManager target = new PluginManager();
            Assert.IsNotNull(target);
        }

        /// <summary>
        ///A test for CreateInstance
        ///</summary>
        [TestMethod()]
        public void CreateInstanceTest()
        {
            PluginManager target = new PluginManager(); // TODO: Initialize to an appropriate value
            Type type = null; // TODO: Initialize to an appropriate value
            object expected = null; // TODO: Initialize to an appropriate value
            object actual;
            actual = target.CreateInstance("C3DModel");
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetPluginList
        ///</summary>
        public void GetPluginListTestHelper<T>()
        {
            PluginManager target = new PluginManager(); // TODO: Initialize to an appropriate value
            string folder = System.AppDomain.CurrentDomain.BaseDirectory + "/plugins"; // TODO: Initialize to an appropriate value
            List<System.Type> actual;
            Engine engine = new Engine();
            actual = target.GetPluginList<System.Type>(folder);
            Assert.IsTrue(actual.Contains(typeof(Engine)));
           // Assert.IsTrue(actual.Contains(new CoreLib.Camera.ThirdPersonCamera));
            
        }

        [TestMethod()]
        public void GetPluginListTest()
        {
            GetPluginListTestHelper<GenericParameterHelper>();
        }
    }
}
